package com.hitqz.robot.dispatch.netty.strategy.job;

import com.hitqz.robot.api.business.entity.RobotJobEntity;
import com.hitqz.robot.dispatch.netty.model.DispatchJobDto;
import com.hitqz.robot.dispatch.netty.service.DispatchService;
import com.hitqz.robot.dispatch.netty.strategy.JobStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author xupkun
 * @date 2025/3/26
 */
@Service("freeFirstStrategy")
@RequiredArgsConstructor
@Slf4j
public class FreeFirstStrategy implements JobStrategy {

    private final DispatchService dispatchService;

    /**
     * 以前的任务流程
     * @param groupId
     */
    @Override
    public DispatchJobDto dispatchJob(Integer groupId, String taskContent) {
        DispatchJobDto dto = new DispatchJobDto();
        String clientId =dispatchService.findExecuteRobot(groupId, taskContent);
        //log.info("{} 空闲优先修改查询最佳执行的AGV: {} ", groupId, clientId);
        dto.setClientId(clientId);
        return  dto;
    }

}
